package icu.d4peng.basic.http.feign.encoding;

import java.util.Arrays;
import java.util.Objects;

import icu.d4peng.basic.core.constant.ProjectConstant;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author d4peng d4peng@qq.com
 * @date 2023-11-26 15:36:16
 */

// @ConfigurationProperties("roc.feign.compression.request")
@ConfigurationProperties(prefix = FeignClientEncodingProperties.PREFIX)
public class FeignClientEncodingProperties {

	public static final String PREFIX = ProjectConstant.PREFIX + ".feign.compression.request";

	/**
	 * The list of supported mime types.
	 */
	private String[] mimeTypes = new String[] { "text/xml", "application/xml", "application/json" };

	/**
	 * The minimum threshold content size.
	 */
	private int minRequestSize = 2048;

	public String[] getMimeTypes() {
		return this.mimeTypes;
	}

	public void setMimeTypes(String[] mimeTypes) {
		this.mimeTypes = mimeTypes;
	}

	public int getMinRequestSize() {
		return this.minRequestSize;
	}

	public void setMinRequestSize(int minRequestSize) {
		this.minRequestSize = minRequestSize;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		FeignClientEncodingProperties that = (FeignClientEncodingProperties) o;
		return Arrays.equals(this.mimeTypes, that.mimeTypes)
				&& Objects.equals(this.minRequestSize, that.minRequestSize);
	}

	@Override
	public int hashCode() {
		return Objects.hash(this.mimeTypes, this.minRequestSize);
	}

	@Override
	public String toString() {
		return new StringBuilder("FeignClientEncodingProperties{").append("mimeTypes=")
			.append(Arrays.toString(this.mimeTypes))
			.append(", ")
			.append("minRequestSize=")
			.append(this.minRequestSize)
			.append("}")
			.toString();
	}

}
